<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>



<form:form commandName="model" cssClass="validate" id="changeForm"
	action="change/change/save">
	<input name="id" type="hidden" value="${model.id }">
	<table class="form-table">
		<jsp:include page="step1view.jsp"></jsp:include>
		<jsp:include page="changeRelateConciView.jsp"></jsp:include>
	</table>

	<div class="header">
		<h3>评估</h3>
	</div>
	<table class="form-table">
		<tr>
			<td class="td1">风险等级：</td>
			<td class="td2" colspan="3"><isperp:dictSelector id="riskRank"
					name="riskRank" typeCode="CHANGE_RISKRANK" dictCssClass="required"
					selectedValue="${riskRank }"></isperp:dictSelector></td>

		</tr>
		<tr>
			<td class="td1">计划开始日期：</td>
			<td class="td2"><input id="planStartTime" name="planStartTime"
				value="${model.planStartTime }" class="required" type="datetime">
			</td>

			<td class="td1">计划截止日期：</td>
			<td class="td2"><input id="planEndTime" name="planEndTime"
				class="required" type="datetime" value="${model.planEndTime }">


			</td>
		</tr>
		<tr>
			<td class="td1">变更影响：</td>
			<td class="td2" colspan="3"><textarea id="effectAnalysis"
					class="required" name="effectAnalysis">${model.effectAnalysis }</textarea>
			</td>
		</tr>
		<tr>
			<td class="td1">业务影响：</td>
			<td class="td2" colspan="3"><textarea id="takeEffect"
					name="takeEffect">${model.takeEffect }</textarea></td>
		</tr>





		<tr>
			<td class="td2" colspan="4">
				<div class="header">
					<h3>支持人员</h3>
				</div>
			</td>
		</tr>

		<tr>
			<td class="td1">变更负责人：</td>
			<td class="td2" colspan="3"><input type="hidden" id="supporter"
				name="supporter" value="${model.supporter }" /> <isperp:departmentUser
					displayValue="${model.supporterName }" valueControlId="supporter"
					id="supporterName" name="supporterName"
					displayValueCssClass="required"></isperp:departmentUser> <form:hidden
					path="supporter" />
			</td>
		</tr>
	</table>


	<div class="header">
		<h3>关联流程</h3>
	</div>
	<isperp:processRelation businessKey="${model.id }" readonly="false"
		processKey="changeProcess" projectIdControl="projectId"></isperp:processRelation>
</form:form>
<script type="text/javascript">
	$(function() {
		var crgId = '${model.chgCategoryId }';
		searchCategoryDandang(crgId);
	});
	function searchCategoryDandang(categoryId) {
		$.getJSON("incident/categoryRelamembers/findRelaAppUserByCategoryIdAndRole?categoryId=" + categoryId, function(data) {

			$("#confirmtimemanId").val(data[0].name);
			$("#confirmtimemanName").val(data[0].fullname);

		});
	}
	function resetPriorityName() {
		var $urgencyName = $("#urgencyName option:selected"), urgencyNameCode = parseInt($urgencyName.data("code"));
		var $effectName = $("#effectName option:selected"), effectNameCode = parseInt($effectName.data("code"));

		var ueVal = urgencyNameCode + effectNameCode;

		var $priorityName = $("#priorityName"), $priorityNameOptions = $("#priorityName option");

		for ( var i = 0; i < $priorityNameOptions.length; i++) {
			var $item = $($priorityNameOptions[i]), code = parseInt($item.data("code"));

			if (ueVal >= code) {
				$priorityName.val($item.val());
				$("#priorityName").trigger("chosen:updated");
				return;
			}
		}

	}

	//-----------------------------------支持人员选择---------------------------------//

	function projectMemberGrid_ActionFormatter(cellvalue, rowObject) {
		return "<a href='javascript:void(0);' onclick='projectMemberGrid_OndbClick(\"" + rowObject.id + "\")'>[选择]</a>";
	}
	function projectMemberGrid_OndbClick(rowid) {
		var rowD = projectMemberGrid.getRowData(rowid);
		$("#supporter").val(rowD.name);
		$("#supporterName").val(rowD.fullname);

	}
	//--------------------------------------------------------------------//
</script>

<isperp:buttonList>
	<isperp:processButtons processKey="changeProcess" formId="changeForm"
		processId="${model.processId }" businessKey="${model.id }"></isperp:processButtons>
</isperp:buttonList>



